<template>
 <div class="Gas_class">
    <gasContent v-if="gasContentif" />
 </div>
</template>

<script>
// import '@/mock/dataCenter.js'
import gasContent from './tabsGas/gasContent.vue'
import productionPlan from './tabsGas/productionPlan.vue'
import reportExport from './tabsGas/reportExport.vue'

export default {
  name: 'test',
  // mixins: [dataCenter],
  components: {
    gasContent,
    productionPlan,
    reportExport
  },
  data () {
    return {
      activeName: 'gasContent',
      gasContentif: true,
      productionPlanif: false,
      reportExportif: false
    }
  },
  computed: {},
  created () {
    if (sessionStorage.getItem('activeTab')) {
      this.activeName = sessionStorage.getItem('activeTab')
      console.log('this', this.activeName)
      this.gasContentif = false
      this.productionPlanif = false
      this.reportExportif = false
      switch (sessionStorage.getItem('activeTab')) {
        case 'gasContent':
          this.gasContentif = true
          break
        case 'productionPlan':
          this.productionPlanif = true
          break
        case 'reportExport':
          this.reportExportif = true
          break
        default:
          break
      }
    } else {
      sessionStorage.setItem('activeTab', this.activeName)
    }
  },
  beforeRouteLeave (to, from, next) {
    sessionStorage.removeItem('activeTab')
    next()
  },
  mounted () {
  },
  methods: {
    handleClick (tab) {
      // console.log('tab', tab)
      sessionStorage.setItem('activeTab', tab.name)
      this.gasContentif = false
      this.productionPlanif = false
      this.reportExportif = false
      switch (tab.index) {
        case '0':
          this.gasContentif = true
          break
        case '1':
          this.productionPlanif = true
          break
        case '2':
          this.reportExportif = true
          break
        default:
          break
      }
    }
  }
}
</script>

<style  scoped>
.block{
  margin-top: 20px;
  text-align: right;
}
.Gas_class {
  .cardTop {
    padding: 0 18px 0px;
  }
}
</style>
